package nl.ru.rd.facedetection.nnbfd.neuralnetwork;

import java.io.Serializable;

/**
 * A sigmoid function to calculate the signal output of a Neuron.
 * 
 * @author Wouter Geraedts (s0814857 - wgeraedts) PGP 66AA5935
 */
public class SigmoidActivationfunction implements Activationfunction, Serializable
{
	private static final long serialVersionUID = -3620336455025997604L;

	@Override
	public double calculate(double x)
	{
		return Math.tanh(x);
	}

	@Override
	public double calculateDerivative(double y)
	{
		return 1.0 - Math.pow(y, 2.0);
	}
}